#include "SearchingClass.h"


SearchingClass::SearchingClass(void)
{
}


SearchingClass::~SearchingClass(void)
{
}


int SearchingClass::BinarySearching(int s[], int nSize, int key)
{
	int low, high, mid;
	low = 0;
	high = nSize-1;

	while (low <= high)
	{
		mid = (low+high)/2;
		if (s[mid] == key)
			return mid;
		else if (s[mid] <key)
			low= mid-1;
		else
			low = mid +1;
	}
	return -1;

}
